package org.emet.service;

import org.emet.jee.console.dao.security.UserDao;
import org.emet.jee.console.entity.security.User;
import org.emet.jee.console.services.security.SpringSecurityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RemotingDestination
@Transactional
public class AdminService {

	@Autowired
	private SpringSecurityService securityService;
	@Autowired
	private UserDao userDao;

	public void saveNewPwd(String newPwd) {
		User user = securityService.getUser();
		user.setPassword(newPwd);
		userDao.save(user);
	}
}
